<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .box {
      width: 300px;
      height: 300px;
      border: 10px solid yellow;
      margin: 40px auto;
      padding: 20px;

    }

    .box1 {
      position: relative;
      width: 200px;
      height: 200px;
      border: 10px solid yellowgreen;
      padding: 20px;
    }

    .box2 {
      position: relative;
      top: 50px;
      left: 20px;
      /* position: absolute;
      top: 0;
      left: 0; */
      width: 100px;
      height: 100px;
      border: 10px solid greenyellow;
      padding: 20px;
    }

    p {
      /*  position: absolute;
      top:0;
      left: 0; */
      width: 50px;
      height: 50px;
      background-color: hotpink;
    }
  </style>
</head>

<body>
  <div class="box">
    <div class="box1">
      <div class="box2">
        <p></p>
      </div>
    </div>
  </div>
</body>

</html>